#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
import json
from ChatGPT_SP_Server.userdata import results 


def main():
    """Run administrative tasks."""
    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ChatGPT_SP_Server.settings')
    try:
        from django.core.management import execute_from_command_line


    except ImportError as exc:
        raise ImportError(
            "Couldn't import Django. Are you sure it's installed and "
            "available on your PYTHONPATH environment variable? Did you "
            "forget to activate a virtual environment?"
        ) from exc
    try:
        with open("results.txt", "r") as f:
            result_text = f.read()
        result_list = json.loads(result_text)
        global results 
        results = result_list
    except (FileNotFoundError, json.JSONDecodeError) as exc:
        results = []  
    execute_from_command_line(sys.argv)


if __name__ == '__main__':
    main()

